<template>
	<view>
		<image src="/static/work1.jpg" mode="" class="img_bg"></image>
		<view class="" style="position: absolute; top: 0; width: 100%;">
			<view class="text-left card padding-l30 bg_white margin-t30">
				<view class="border-bottom display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30">风险点名称</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.danger_name?danger_listMenu.danger_name:'-'}}</view>
				</view>
				<view class="border-bottom display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30 ">风险等级</view>
					<view class="text-32  padding-r30" :class=" danger_listMenu.danger_level_show==ldanger?'font-0':danger_listMenu.danger_level_show==pdanger?'font-1':danger_listMenu.danger_level_show==mdanger?'font-2':'font-3' ">{{danger_listMenu.danger_level_show?danger_listMenu.danger_level_show:'-'}}</view>
				</view>

				<view class="border-bottom display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30 ">风险点位置</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.danger_position?danger_listMenu.danger_position:'-'}}</view>
				</view>
				<view class="border-bottom display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30">所属部门</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.position_id?danger_listMenu.position_id:'-'}}</view>
				</view>
				<view class="display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30">负责人</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.charge_userid_show?danger_listMenu.charge_userid_show:'-'}}</view>
				</view>

				<view class="border-bottom display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30">管控层级</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.control_level_show?danger_listMenu.control_level_show:'-'}}</view>
				</view>
				<view class="border-bottom  justify-between align-center display">
					<view class="text-36 padding-t30 padding-b30  display">风险类型</view>
					<view class="text-32 font-gray1 padding-r30 display">
						<block v-for="(item,index) in danger_type" :key="index">
							<view class="">{{item.safety_name?item.safety_name:'-'}}/</view>
						</block>
					</view>
				</view>
				<view class="border-bottom display justify-between align-center">
					<view class="text-36 padding-t30 padding-b30">易发生事故</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.danger_accident?danger_listMenu.danger_accident:'-'}}</view>
				</view>
				<view class="border-bottom display justify-between align-center flex-wrap">
					<view class="text-36 padding-t30 padding-b30">主要危险有害性</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.reason?danger_listMenu.reason:'-'}}</view>
				</view>
				<view class="border-bottom display justify-between align-center flex-wrap">
					<view class="text-36 padding-t30 padding-b30">措施</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.danger_measures?danger_listMenu.danger_measures:'-'}}</view>
				</view>
				<view class="border-bottom display justify-between align-center flex-wrap">
					<view class="text-36 padding-t30 padding-b30">应急处置对策</view>
					<view class="text-32 font-gray1 padding-r30">{{danger_listMenu.change_measures?danger_listMenu.change_measures:'-'}}</view>
				</view>
			</view>
			
				<view @tap="start" class="starta starting "  v-show="!button_hid">
					<view class="start-text">
						开始巡检
					</view>
				</view>
			
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				danger_id: '',
				danger_listMenu: {},
				danger_type: {},
				uid: '',
				token: '',
				msg: '',
				d_id: '',
				ldanger:'低风险',
				pdanger:'一般风险',
				mdanger:'较大风险',
				hdanger:'高风险',
				button_hid:"",
				inspection_id:0,
				is_measures:0
			}
		},
		onLoad(options) {
			this.button_hid=options.rel
			this.danger_id = options.id
			this.inspection_id = options.inspection_id
			this.danger_list(options.id)
			this.uid = uni.getStorageSync('user').uid;
			this.token = uni.getStorageSync('user').token;
		},
		methods: {
			danger_list(e) {
				let _self = this;
				uni.request({
					url: 'https://aqmore.sxpz.vip/AppApi/Danger/detail?danger_id=' + e,
					method: 'GET',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					success: function(res) {
						_self.danger_listMenu = res.data.datas.danger
						_self.danger_type = res.data.datas.danger.danger_type
						_self.d_id = res.data.datas.danger.id
					}
				})
			},
			start() {
				var that = this
				uni.request({
					url: 'https://aqmore.sxpz.vip/AppApi/Danger/isAllow',
					method: 'GET',
					header: {
						'content-type': 'application/x-www-form-urlencoded'
					},
					data:{
						uid:this.uid,
						token:this.token,
						danger_id:this.danger_id
					},
					success: function(res) {
						if (res.data.code == 200) {
							uni.navigateTo({
								url: 'pollingDetail?id=' + that.d_id +"&inspection_id=" + that.inspection_id,
							})
						} else if (res.data.code == 400) {
							uni.showToast({
								title: res.data.datas.msg,
								icon: 'none'
							})
						}
					}
				})
			}
		},

	}
</script>

<style>
	page {
		height: 100%;
		width: 100%;
	}

	/*白色的card*/
	.card {
		background-color: #ffffff;
		box-shadow: 0 2upx 8upx 0 rgba(0, 0, 0, 0.06);
		border-radius: 20upx;
		padding: 30upx 24upx;
	}

	.margin-t30 {
		margin-top: 30upx;
	}

	.relative {
		position: relative;
	}

	.text-36 {
		font-size: 36upx;
	}

	.display {
		display: flex;
	}

	.justify-between {
		justify-content: space-between;
	}

	.margin-t22 {
		margin-top: 22upx;
	}

	.font-blue {
		color: #3F5EFF;
	}

	.font-gray1 {
		color: #00aaff;
	}

	.button_start {
		position: relative;
		left: 35%;

	}
	.starting {
		z-index: 10000;
		top: 66%;
		left: 35%;
		position: fixed;
		width: 232upx;
		height: 232upx;
		box-shadow: 0 4upx 30upx 0 rgba(52, 115, 255, 1);
		background-color: #309fff;
		border-radius: 100%;
		text-align: center;
		opacity:0.7;

	}

	.start-text {
		margin-top: 40%;
	}
	.font-0 {
		color: #3F5EFF;
	}
	
	.font-1 {
		color: #ffe200;
	}
	
	.font-2 {
		color: #ff5500;
	}
	
	.font-3 {
		color: #ff0000;
	}
</style>
